import { _decorator, Component, director, EventHandler, Node, ToggleContainer } from 'cc';
const { ccclass, property } = _decorator;
import StorageUtil from '../utils/StorageUtil';
import Constants from '../Constants';
import {HERO_ENUM} from '../Enum';

@ccclass('HeroControl')
export class HeroControl extends Component {
    start() {
        this._init()
    }

    update(deltaTime: number) {
        
    }
    onLoad(){
        // 场景预加载
        director.preloadScene("main")
    }
    _init(){
        //默认选中第一个角色
        StorageUtil.set(Constants.HERO_SELECT,HERO_ENUM.HERO_ZERO)
    }
    // 选择角色事件
    heroSelect(event: Event, customEventData: string){
        StorageUtil.set(Constants.HERO_SELECT,customEventData)
    }
    //开始游戏事件
    gameStart(){
        //场景切换
        director.loadScene("main")
    }
}


